package com.wasion.pwportable.protocol.p2;

/**
 * 
 * @ClassName: FrameFieldsLength
 * @Description: 传输帧各字段长度
 * @author 高意
 * @date Apr 14, 2016 2:50:39 PM
 * 
 */
public interface FrameFieldsLength {

	/**
	 * 
	 * @ClassName: ControlFieldLengthEnum
	 * @Description: 控制域长度枚举
	 * @author 高意
	 * @date Apr 14, 2016 5:25:24 PM
	 * 
	 */
	public enum ControlFieldLengthEnum {

		LENGTH_CONTROL_FIELD_1(1), // 1
		LENGTH_CONTROL_FIELD_4(4); // 4

		// 成员变量
		private int index;

		// 构造方法
		private ControlFieldLengthEnum(int index) {
			this.index = index;
		}

		public int getIndex() {
			return index;
		}

		public void setIndex(int index) {
			this.index = index;
		}
	}

	/**
	 * 
	 * @ClassName: LinkAddrLengthEnum
	 * @Description: 链路地址长度枚举
	 * @author 高意
	 * @date Apr 14, 2016 4:26:27 PM
	 * 
	 */
	public enum LinkAddrLengthEnum {

		LENGTH_LINK_ADDR_2(2), // 2
		LENGTH_LINK_ADDR_4(4), // 4
		LENGTH_LINK_ADDR_6(6); // 6

		// 成员变量
		private int index;

		// 构造方法
		private LinkAddrLengthEnum(int index) {
			this.index = index;
		}

		public int getIndex() {
			return index;
		}

		public void setIndex(int index) {
			this.index = index;
		}
	}

	/**
	 * 
	 * @ClassName: AsduPublicAddrLengthEnum
	 * @Description: ASDU公共地址长度枚举
	 * @author 高意
	 * @date Apr 14, 2016 2:59:34 PM
	 * 
	 */
	public enum AsduPublicAddrLengthEnum {

		LENGTH_ASDU_ADDR_2(2), // 2
		LENGTH_ASDU_ADDR_4(4); // 4

		// 成员变量
		private int index;

		// 构造方法
		private AsduPublicAddrLengthEnum(int index) {
			this.index = index;
		}

		public int getIndex() {
			return index;
		}

		public void setIndex(int index) {
			this.index = index;
		}
	}

	/**
	 * 
	 * @ClassName: COTLengthEnum
	 * @Description: 传输原因长度枚举
	 * @author 高意
	 * @date Apr 14, 2016 3:01:45 PM
	 * 
	 */
	public enum COTLengthEnum {

		LENGTH_COT_1(1), // 1
		LENGTH_COT_2(2); // 2

		// 成员变量
		private int index;

		// 构造方法
		private COTLengthEnum(int index) {
			this.index = index;
		}

		public int getIndex() {
			return index;
		}

		public void setIndex(int index) {
			this.index = index;
		}
	}

	/**
	 * 
	 * @ClassName: InfoObjectAddrLengthEnum
	 * @Description: 信息对象地址长度枚举
	 * @author 高意
	 * @date Apr 14, 2016 3:01:45 PM
	 * 
	 */
	public enum InfoObjectAddrLengthEnum {

		LENGTH_INFO_ADDR_2(2), // 2
		LENGTH_INFO_ADDR_3(3); // 3

		// 成员变量
		private int index;

		// 普通方法
		public static int getIndex(InfoObjectAddrLengthEnum e) {
			for (InfoObjectAddrLengthEnum c : InfoObjectAddrLengthEnum.values()) {
				if (c.ordinal() == e.index) {
					return c.ordinal();
				}
			}
			return 0;
		}

		// 构造方法
		private InfoObjectAddrLengthEnum(int index) {
			this.index = index;
		}

		public int getIndex() {
			return index;
		}

		public void setIndex(int index) {
			this.index = index;
		}
	}
}
